package com.sskj.givecoin.v.activity;

import android.content.Context;
import android.content.Intent;
import android.widget.TextView;

import com.sskj.givecoin.R;
import com.sskj.givecoin.common.widget.ToolBarLayout;
import com.sskj.givecoin.m.bean.WKEntry;
import com.sskj.givecoin.p.activity.WKPresenter;
import com.sskj.givecoin.v.base.BaseActivity;
import com.zzhoujay.richtext.RichText;

import butterknife.BindView;

public class WKActivity extends BaseActivity<WKPresenter> {


    @BindView(R.id.useful_num)
    TextView usefulNum;
    @BindView(R.id.frost_num)
    TextView frostNum;
    @BindView(R.id.tip)
    TextView tip;
    @BindView(R.id.toolbar)
    ToolBarLayout toolbar;

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_wk;
    }

    @Override
    public WKPresenter getPresenter() {
        return new WKPresenter();
    }


    @Override
    protected void initView() {
        toolbar.setLeftButtonOnClickLinster(v -> finish());
    }

    @Override
    protected void initData() {
        mPresenter.getData();
    }

    public void setData(WKEntry data) {
        setText(usefulNum, data.getUsable());
        setText(frostNum, data.getFrost() );
        RichText.from(data.getNote()).into(tip);
    }


    public static void start(Context context) {
        Intent intent = new Intent(context, WKActivity.class);
        context.startActivity(intent);
    }

}
